<template>
  <TreePicker :option="param" :model-value="modelValue" :filterable="true" @change="change" @input="input" :multiple="multiple"
    :disabled="disabled"></TreePicker>
</template>
<script>
export default {
  name: "PaasTree",
  props: {
    multiple: {
      default: false,
    },
    disabled: {
      default: false,
    },
    modelValue: {
    },
    params: {},
    url: "",
  },
  data() {
    return {
      param: {
        keyName: "value",
        titleName: "label",
        parentName: "supperId",
        childrenName: "children",
        dataMode: "list",
        getTotalDatas: (resolve) => {
          this.$post(this.url, { page: { current: 1, size: 1000000 }, ...this.params }).then((res) => {
            let data = res.data.data.rows;
            resolve(data);
          });
        },
      },
    }
  },
  mounted() {
  },
  methods: {
    input(data) {
      this.$emit("update:modelValue", data.value);
      this.$emit("input", data);
    },
    change(data) {
      this.$emit("update:modelValue", data.value);
      this.$emit("change", data);
    },
  },
};
</script>